Skip to content

Conversation

@LarsKue
Copy link
Contributor

@LarsKue LarsKue commented Mar 21, 2025

Fixes #363

@LarsKue LarsKue added the fix Pull request that fixes a bug label Mar 21, 2025
@LarsKue LarsKue self-assigned this Mar 21, 2025
@codecov
Copy link

codecov bot commented Mar 21, 2025

Codecov Report

Attention: Patch coverage is 86.66667% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
bayesflow/datasets/offline_dataset.py 86.66% 2 Missing ⚠️
Files with missing lines Coverage Δ
bayesflow/datasets/offline_dataset.py 92.50% <86.66%> (-3.93%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@paul-buerkner
Copy link
Contributor

Thanks for the fix! Looks good I think.

@paul-buerkner paul-buerkner self-requested a review March 21, 2025 11:38
Copy link
Contributor

@paul-buerkner paul-buerkner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.


def __init__(self, data: dict[str, np.ndarray], batch_size: int, adapter: Adapter | None, **kwargs):
def __init__(
self, data: dict[str, np.ndarray], batch_size: int, adapter: Adapter | None, num_samples: int = None, **kwargs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add docs about the arguments of the DataSet classes. But I guess this can be done independently of this bug fix.

self.adapter = adapter
self.num_samples = next(iter(data.values())).shape[0]

if num_samples is None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do like that the user has both options (a) to automatically compute num_samples (default) or (b) to manually specify it, if for some reason, num_samples cannot be reliably inferred by the data.

@LarsKue LarsKue merged commit 283c5a0 into main Mar 21, 2025
15 checks passed
@LarsKue LarsKue deleted the fix-offline-dataset-for-non-array branch March 21, 2025 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Pull request that fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Offline dataset not possible with a meta function

3 participants